/////////////////////////////////////////////////////////////////////////////
// Copyright(c) 2012-2015 purang All Rights Reserved
// Name:        socket_host_table.h
// Purpose:
// Author:      xichuntao
// Modified by:
// Created:     2016/10/24 13:18
// RCS-ID:
// Licence:
/////////////////////////////////////////////////////////////////////////////
#ifndef _SOCKET_HOST_TABLE_H_
#define _SOCKET_HOST_TABLE_H_

#include <string.h>

#include <string>
#define STR_LENGTH_1 32
#define STR_LENGTH_2 64
namespace qb {
typedef char ArrayChar32[STR_LENGTH_1];
class CChar32 {
 public:
  CChar32(const std::string& str) {
    memset(m_Char, 0, STR_LENGTH_1);
#ifdef _MSC_VER
    strncpy_s(m_Char, STR_LENGTH_1, str.c_str(), STR_LENGTH_1 - 1);
#else
    strcpy(m_Char, str.c_str());
#endif
  }

  CChar32(const char* host) {
    if (NULL == host) {
      return;
    }
    memset(m_Char, 0, STR_LENGTH_1);
#ifdef _MSC_VER
    strncpy_s(m_Char, STR_LENGTH_1, host, STR_LENGTH_1 - 1);
#else
    strcpy(m_Char, host);
#endif
  }
  char* getChar() { return m_Char; }
  bool operator<(const CChar32& cmp) const {
    std::string strMy = m_Char;
    std::string strCmp = cmp.m_Char;
    return strMy < strCmp;
  }

 private:
  ArrayChar32 m_Char;
};
}  // namespace qb

#endif  // _SOCKET_WRAPPER_H_
